<?php if(!defined("HDPHP_PATH"))exit;C("SHOW_NOTICE",FALSE);?><!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>货品管理</title>
<script type='text/javascript' src='http://localhost/gks/1113/hdphp/hdphp/Extend/Org/Jquery/jquery-1.8.2.min.js'></script>
<link href='http://localhost/gks/1113/hdphp/hdphp/Extend/Org/hdjs/hdui/css/hdui.css' rel='stylesheet' media='screen'>
<script src='http://localhost/gks/1113/hdphp/hdphp/Extend/Org/hdjs/hdui/js/hdui.js'></script>
<link href='http://localhost/gks/1113/hdphp/hdphp/Extend/Org/hdjs/hdvalidate/css/hdvalidate.css' rel='stylesheet' media='screen'>
<script src='http://localhost/gks/1113/hdphp/hdphp/Extend/Org/hdjs/hdvalidate/js/hdvalidate.js'></script>
<script src='http://localhost/gks/1113/hdphp/hdphp/Extend/Org/cal/lhgcalendar.min.js'></script>
<script src='http://localhost/gks/1113/hdphp/hdphp/Extend/Org/hdjs/hdslide/js/hdslide.js'></script>
<script type='text/javascript'>
HOST = 'http://localhost';
ROOT = 'http://localhost/gks/1113/shop';
WEB = 'http://localhost/gks/1113/shop/index.php';
URL = 'http://localhost/gks/1113/shop/index.php/Admin/Product/manage/goods_gid/2';
APP = 'http://localhost/gks/1113/shop/HSHOP';
COMMON = 'http://localhost/gks/1113/shop/HSHOP/Common';
HDPHP = 'http://localhost/gks/1113/hdphp/hdphp';
HDPHPDATA = 'http://localhost/gks/1113/hdphp/hdphp/Data';
HDPHPEXTEND = 'http://localhost/gks/1113/hdphp/hdphp/Extend';
MODULE = 'http://localhost/gks/1113/shop/index.php/Admin';
CONTROLLER = 'http://localhost/gks/1113/shop/index.php/Admin/Product';
ACTION = 'http://localhost/gks/1113/shop/index.php/Admin/Product/manage';
STATIC = 'http://localhost/gks/1113/shop/Static';
HDPHPTPL = 'http://localhost/gks/1113/hdphp/hdphp/Lib/Tpl';
VIEW = 'http://localhost/gks/1113/shop/HSHOP/Admin/View';
PUBLIC = 'http://localhost/gks/1113/shop/HSHOP/Admin/View/Public';
CONTROLLERVIEW = 'http://localhost/gks/1113/shop/HSHOP/Admin/View/Product';
HISTORY = 'http://localhost/gks/1113/shop/index.php/Admin/Product/manage/goods_gid/2';
</script>
</head>
<body>
	<div class="wrap">
		<div class="menu_list">
			<ul>
				<li><a href="<?php echo U('Product/manage',array('goods_gid'=>$attr['attr_id'][0]['goods_gid']));?>" class="action">货品管理</a></li>
				<li><a href="<?php echo U('Goods/index');?>">商品列表</a></li>
			</ul>
		</div>
		<form action="" method="post">
		<input type="hidden" name="goods_gid" value="<?php echo $_GET['goods_gid'];?>">
			<table class="table2 hd-form">
				<thead>
				
					<tr>
						<?php $hd["list"]["a"]["total"]=0;if(isset($attr) && !empty($attr)):$_id_a=0;$_index_a=0;$lasta=min(1000,count($attr));
$hd["list"]["a"]["first"]=true;
$hd["list"]["a"]["last"]=false;
$_total_a=ceil($lasta/1);$hd["list"]["a"]["total"]=$_total_a;
$_data_a = array_slice($attr,0,$lasta);
if(count($_data_a)==0):echo "";
else:
foreach($_data_a as $key=>$a):
if(($_id_a)%1==0):$_id_a++;else:$_id_a++;continue;endif;
$hd["list"]["a"]["index"]=++$_index_a;
if($_index_a>=$_total_a):$hd["list"]["a"]["last"]=true;endif;?>

							<td><?php echo $a[0]['attr_name'];?></td>
						<?php $hd["list"]["a"]["first"]=false;
endforeach;
endif;
else:
echo "";
endif;?>
						<td>货号</td>
						<td>库存</td>
						<td>操作</td>
					</tr>
				</thead>
				<tbody>
					<?php $hd["list"]["p"]["total"]=0;if(isset($product) && !empty($product)):$_id_p=0;$_index_p=0;$lastp=min(1000,count($product));
$hd["list"]["p"]["first"]=true;
$hd["list"]["p"]["last"]=false;
$_total_p=ceil($lastp/1);$hd["list"]["p"]["total"]=$_total_p;
$_data_p = array_slice($product,0,$lastp);
if(count($_data_p)==0):echo "";
else:
foreach($_data_p as $key=>$p):
if(($_id_p)%1==0):$_id_p++;else:$_id_p++;continue;endif;
$hd["list"]["p"]["index"]=++$_index_p;
if($_index_p>=$_total_p):$hd["list"]["p"]["last"]=true;endif;?>

						<tr>
							<?php $hd["list"]["attr_name"]["total"]=0;if(isset($p['goods_attr_str']) && !empty($p['goods_attr_str'])):$_id_attr_name=0;$_index_attr_name=0;$lastattr_name=min(1000,count($p['goods_attr_str']));
$hd["list"]["attr_name"]["first"]=true;
$hd["list"]["attr_name"]["last"]=false;
$_total_attr_name=ceil($lastattr_name/1);$hd["list"]["attr_name"]["total"]=$_total_attr_name;
$_data_attr_name = array_slice($p['goods_attr_str'],0,$lastattr_name);
if(count($_data_attr_name)==0):echo "";
else:
foreach($_data_attr_name as $key=>$attr_name):
if(($_id_attr_name)%1==0):$_id_attr_name++;else:$_id_attr_name++;continue;endif;
$hd["list"]["attr_name"]["index"]=++$_index_attr_name;
if($_index_attr_name>=$_total_attr_name):$hd["list"]["attr_name"]["last"]=true;endif;?>

								<td><?php echo $attr_name;?></td>
							<?php $hd["list"]["p"]["first"]=false;
endforeach;
endif;
else:
echo "";
endif;?>
							<td><?php echo $p['product_sn'];?></td>
							<td><?php echo $p['product_number'];?></td>
							<td>
			                    <a href="javascript:;" onclick="delProduct(this,<?php echo $p['product_id'];?>)">[一]</a>
			                </td>
						</tr>
					<?php $hd["list"]["attr_name"]["first"]=false;
endforeach;
endif;
else:
echo "";
endif;?>
					<tr>
						<?php $hd["list"]["a"]["total"]=0;if(isset($attr) && !empty($attr)):$_id_a=0;$_index_a=0;$lasta=min(1000,count($attr));
$hd["list"]["a"]["first"]=true;
$hd["list"]["a"]["last"]=false;
$_total_a=ceil($lasta/1);$hd["list"]["a"]["total"]=$_total_a;
$_data_a = array_slice($attr,0,$lasta);
if(count($_data_a)==0):echo "";
else:
foreach($_data_a as $key=>$a):
if(($_id_a)%1==0):$_id_a++;else:$_id_a++;continue;endif;
$hd["list"]["a"]["index"]=++$_index_a;
if($_index_a>=$_total_a):$hd["list"]["a"]["last"]=true;endif;?>

							<td>
								<select name="attr[<?php echo $a[0]['attr_id'];?>][]">
									<option value="0">==属性选择==</option>
									<?php $hd["list"]["d"]["total"]=0;if(isset($a) && !empty($a)):$_id_d=0;$_index_d=0;$lastd=min(1000,count($a));
$hd["list"]["d"]["first"]=true;
$hd["list"]["d"]["last"]=false;
$_total_d=ceil($lastd/1);$hd["list"]["d"]["total"]=$_total_d;
$_data_d = array_slice($a,0,$lastd);
if(count($_data_d)==0):echo "";
else:
foreach($_data_d as $key=>$d):
if(($_id_d)%1==0):$_id_d++;else:$_id_d++;continue;endif;
$hd["list"]["d"]["index"]=++$_index_d;
if($_index_d>=$_total_d):$hd["list"]["d"]["last"]=true;endif;?>

										<option value="<?php echo $d['id'];?>"><?php echo $d['attr_value'];?></option>
									<?php $hd["list"]["a"]["first"]=false;
endforeach;
endif;
else:
echo "";
endif;?>
								</select>
							</td>
						<?php $hd["list"]["d"]["first"]=false;
endforeach;
endif;
else:
echo "";
endif;?>
						<td><input type="text" name="product_sn[]"></td>
						<td><input type="text" name="product_number[]"></td>
						<td><a href="javascript:;" onclick="addProduct(this)">[十]</a></td>
					</tr>
				</tbody>
			</table>
			<br/>
			<input type="submit" value="确定" class="hd-success">
		</form>
	</div>
	<script type="text/javascript" src="http://localhost/gks/1113/shop/HSHOP/Admin/View/Product/js/js.js"></script>
</body>
</html>